import request from '@/utils/request'

// 查询采购需求单列表
export function listDemand(query) {
  return request({
    url: '/purchase/demand/list',
    method: 'post',
    data: query
  })
}

// 查询采购需求单信息详细
export function getDemand(id) {
  return request({
    url: '/purchase/demand/' + id,
    method: 'get'
  })
}

// 新增采购需求单信息
export function addDemand(data) {
  return request({
    url: '/purchase/demand/add',
    method: 'post',
    data: data
  })
}

// 修改采购需求单信息
export function updateDemand(data) {
  return request({
    url: '/purchase/demand/update',
    method: 'post',
    data: data
  })
}
//关闭采购需求单
export function close(id){
  return request({
    url: '/purchase/demand/close/' + id,
    method: 'post'
  })
}
//根据采购需求单批量生成采购单的时候获取一个合并的采购需求单信息
export function mergeBatchDemands(ids){
  return request({
    url: '/purchase/demand/mergeBatchDemands/'+ids,
    method: 'post'
  })
}